import { nextTick } from "vue";
import {loadCss,loadJs} from './common'
const cssUrls= [
    '//at.alicdn.com/t/font_3135462_5axiswmtpj.css', // 示例链接，建议替换
    '//cdn.bootcdn.net/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css',
]
const jsUrls = []

export default function init(){
    if(cssUrls.length>0){
        cssUrls.map(v=>{
            loadCss(v);
        })
    }
    if(jsUrls.length>0){
        jsUrls.map(v=>{
            loadJs(v);
        })

    }
}
/*
 * 获取当前页面中从指定域名加载到的样式表内容
 * 样式表未载入前无法获取
 */
function getStylesFromDomain(domain) {
    const sheets = []
    const styles = document.styleSheets
    for (const key in styles) {
        if (styles[key].href && (styles[key].href).indexOf(domain) > -1) {
            sheets.push(styles[key])
        }
    }
    return sheets
}